import request from "@/config/request.js";

const articleApi = {
  selectAll: "/article/selectAll",
  selectByPage: "/article/selectByPage",
  detail: "/article/selectById",
  insert: "/article/create",
  update: "/article/update",
  updateStatus: "/article/updateStatus",
  remove: "/article/remove",
  view: "/article/view",
  like: "/article/like",
};


/**
 * 文章分页列表
 * @param {*} params
 * @returns
 */
export const selectAll = params => {
  return request.get(articleApi.selectAll, { params });
};

/**
 * 文章分页列表
 * @param {*} params
 * @returns
 */
export const selectByPage = params => {
  return request.get(articleApi.selectByPage, { params });
};

/**
 * 文章详情
 * @param {*} params
 * @returns
 */
export const detail = params => {
  return request.get(articleApi.detail, { params });
};

/**
 * 添加文章
 * @param {*} params
 * @returns
 */
export const insert = params => {
  return request.post(articleApi.insert, params);
};

/**
 * 更新文章
 * @param {*} params
 * @returns
 */
export const update = params => {
  return request.put(articleApi.update, params);
};

/**
 * 更新文章
 * @param {*} params
 * @returns
 */
export const updateStatus = params => {
  return request.put(articleApi.updateStatus, params);
};

/**
 * 删除文章
 * @param {*} params
 * @returns
 */
export const remove = params => {
  return request.delete(articleApi.remove, params);
};

/**
 * 浏览文章
 * @param {*} params
 * @returns
 */
export const doView = params => {
  return request.put(articleApi.view, params);
};

/**
 * 浏览文章
 * @param {*} params
 * @returns
 */
export const doLike = params => {
  return request.put(articleApi.like, params);
};
